package com.liao.badminton.dto;

import com.liao.badminton.code.BaseField;
import com.liao.badminton.code.validation.Delete;
import com.liao.badminton.code.validation.Insert;
import com.liao.badminton.code.validation.Update;
import io.swagger.annotations.ApiModelProperty;
import com.liao.badminton.entity.SystemMenu;
import javax.validation.constraints.NotNull;
import java.util.List;
import lombok.Data;
import com.liao.badminton.code.validation.FindDetail;
import java.lang.String;
import java.util.Date;

/**
* @author liaocheng
* @date 2024-11-01
* description:菜单权限表
*/
@Data
public class SystemMenuDto extends BaseField {

    @ApiModelProperty(value = "菜单ID")
    @NotNull(message = "主键id不能为空",groups = {Update.class, FindDetail.class})
    private Long id;

    @ApiModelProperty(value = "菜单名称")
    private String name;

    @ApiModelProperty(value = "权限标识")
    private String permission;

    @ApiModelProperty(value = "菜单类型")
    private Integer type;

    @ApiModelProperty(value = "显示顺序")
    private Integer sort;

    @ApiModelProperty(value = "父菜单ID")
    private Long parentId;

    @ApiModelProperty(value = "路由地址")
    private String path;

    @ApiModelProperty(value = "菜单图标")
    private String icon;

    @ApiModelProperty(value = "组件路径")
    private String component;

    @ApiModelProperty(value = "组件名")
    private String componentName;

    @ApiModelProperty(value = "菜单状态")
    private Integer status;

    @ApiModelProperty(value = "是否可见")
    private Integer visible;

    @ApiModelProperty(value = "是否缓存")
    private Integer keepAlive;

    @ApiModelProperty(value = "是否总是显示")
    private Integer alwaysShow;

    @NotNull(message = "主键id不能为空",groups = {Delete.class})
    private List<Long> delIds;  //批量删除ids

    public SystemMenu invertEntity(){
        SystemMenu dto = new SystemMenu();
        BaseField.invert(this, dto);
        dto.setId(this.getId());
        dto.setName(this.getName());
        dto.setPermission(this.getPermission());
        dto.setType(this.getType());
        dto.setSort(this.getSort());
        dto.setParentId(this.getParentId());
        dto.setPath(this.getPath());
        dto.setIcon(this.getIcon());
        dto.setComponent(this.getComponent());
        dto.setComponentName(this.getComponentName());
        dto.setStatus(this.getStatus());
        dto.setVisible(this.getVisible());
        dto.setKeepAlive(this.getKeepAlive());
        dto.setAlwaysShow(this.getAlwaysShow());
        return dto;
    }
}
